package com.skivingcloud.report.service.impl;

import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.skivingcloud.report.entity.ReportLuckysheetReportBlockCell;
import com.skivingcloud.report.mapper.ReportLuckysheetReportBlockCellMapper;
import com.skivingcloud.report.service.ReportLuckysheetReportBlockCellService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.skivingcloud.common.utils.PageParameter;

/**
 * 查询报表循环块信息 服务层实现。
 *
 * @author skivingcloud
 * @since 2024-11-07
 */
@Service
public class ReportLuckysheetReportBlockCellServiceImpl extends ServiceImpl<ReportLuckysheetReportBlockCellMapper, ReportLuckysheetReportBlockCell> implements ReportLuckysheetReportBlockCellService {

    /**
     * 分页查询查询报表循环块信息
     *
     * @param parameter 查询参数
     * @return 分页查询结果
     */
    @Override
    public Page<ReportLuckysheetReportBlockCell> queryByPage(PageParameter<ReportLuckysheetReportBlockCell> parameter){
        Page<ReportLuckysheetReportBlockCell> page = new Page<>(parameter.getPage(), parameter.getPageSize());
        QueryWrapper queryWrapper = QueryWrapper.create();
        if (parameter.getParam() != null) {
            //查询条件
            if (StringUtils.isNoneBlank(parameter.getParam().getId())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getId).like(parameter.getParam().getId());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getTplId())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getTplId).like(parameter.getParam().getTplId());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getReportCellId())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getReportCellId).like(parameter.getParam().getReportCellId());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getDatasetName())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getDatasetName).like(parameter.getParam().getDatasetName());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCellValue())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getCellValue).like(parameter.getParam().getCellValue());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCellData())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getCellData).like(parameter.getParam().getCellData());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCellValueType())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getCellValueType).like(parameter.getParam().getCellValueType());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getIsLink())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getIsLink).like(parameter.getParam().getIsLink());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getLinkConfig())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getLinkConfig).like(parameter.getParam().getLinkConfig());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getIsMerge())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getIsMerge).like(parameter.getParam().getIsMerge());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getIsFunction())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getIsFunction).like(parameter.getParam().getIsFunction());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getIsDataVerification())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getIsDataVerification).like(parameter.getParam().getIsDataVerification());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getDataVerification())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getDataVerification).like(parameter.getParam().getDataVerification());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getCreator())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getCreator).like(parameter.getParam().getCreator());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getUpdater())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getUpdater).like(parameter.getParam().getUpdater());
            }
            if (StringUtils.isNoneBlank(parameter.getParam().getDelFlag())) {
                queryWrapper.and(ReportLuckysheetReportBlockCell::getDelFlag).like(parameter.getParam().getDelFlag());
            }
        }
        return this.page(page, queryWrapper);
    }
}
